<?php
require_once('feed.php');
class shopping extends feed{
	var $mapping;
	var $mpn;
	var $upc;
	var $Categorization;
	var $Stock_Description;
	var $zip_code;
	public function __construct($site,$products){
	parent::__construct($site,$products);
	$this->mapping=array('MPN','Manufacturer Name','UPC','Product Name','Product Description','Product Price','Product URL','Image URL','Shopping.com Categorization','Stock Availability','Stock Description','Ground Shipping','Weight','Zip Code');
	$this->mpn='784211';
	$this->upc='44547685907';
	$this->Categorization='Electronics -> phone';
	$this->Stock_Description='Ships Next Day';
	$this->zip_code='90210710821';
	}	
		
	public function toCsv(){
		$this->csv.=$this->mapping[0];
		for($i=1;$i<sizeof($this->mapping);$i++){
			$this->csv.=','.$this->mapping[$i];
			}
		$this->csv.=chr(13);	
		
		foreach($this->data as $info){
			$this->csv.=$this->mpn;
			$this->csv.=',';
			$this->csv.=$info['made_in'];
			$this->csv.=',';
			$this->csv.=$this->upc;
			$this->csv.=',';
			$this->csv.=$info['name'];
			$this->csv.=',';
			$this->csv.=str_replace(',','',$info['description']);
			$this->csv.=',';
			$this->csv.=$info['price'];
			$this->csv.=',';
			$this->csv.=$info['product_url'];
			$this->csv.=',';
			$this->csv.=$info['image_url'];
			$this->csv.=',';
			$this->csv.=$this->Categorization;
			$this->csv.=',';
			$this->csv.=$info['is_store_have'];
			$this->csv.=',';
			$this->csv.=$this->Stock_Description;
			$this->csv.=',';
			$this->csv.=' ';
			$this->csv.=',';
			$this->csv.=$info['weight'];
			$this->csv.=',';
			$this->csv.=$this->zip_code;
			$this->csv.=chr(13);
			}
			
			return $this->csv;
		
	}	

}
?>